/*
 * Copyright (c) 2024-2024 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef POWERMGR_PROXIMITY_CONTROLLER_BASE_H
#define POWERMGR_PROXIMITY_CONTROLLER_BASE_H

#ifdef HAS_SENSORS_SENSOR_PART
#include <mutex>
#endif
#include "sensor_agent.h"
#include "power_state_machine_info.h"
#include "iproximity_controller.h"

namespace OHOS {
namespace PowerMgr {
class ProximityControllerBase : public IProximityController {
public:
    typedef void (*SensorCallbackFunc)(SensorEvent *event);
    ProximityControllerBase() = default;
    ProximityControllerBase(const std::string& name, SensorCallbackFunc callback);
    virtual ~ProximityControllerBase();
    bool InitProximitySensorUser();
    void Enable() override;
    void Disable() override;
    void OnClose() override {}
    void OnAway() override {}
    static const int32_t PROXIMITY_CLOSE_SCALAR = 0;
    static const int32_t PROXIMITY_AWAY_SCALAR = 5;
    static const uint32_t SAMPLING_RATE =  100000000;
private:
    SensorCallbackFunc callback_ = nullptr;
    std::string name_ {};
    SensorUser user_ {};
};
} // namespace PowerMgr
} // namespace OHOS
#endif // POWERMGR_PROXIMITY_CONTROLLER_BASE_H